:root {
  --sky: #38bdf8;
  --sky-deep: #0ea5e9;
  --pitch: #59d337;
  --coral: #ff4f7b;
  --pink: #ff83b6;
  --gold: #ffd166;
  --ink: #102a43;
  --cloud: rgba(255, 255, 255, 0.92);
  --glass: rgba(255, 255, 255, 0.72);
  --shadow: 0 18px 40px rgba(11, 85, 124, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  overflow: hidden;
  font-family: "Nunito", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.95) 0 8%, transparent 9%),
    radial-gradient(circle at 84% 8%, rgba(255, 255, 255, 0.7) 0 9%, transparent 10%),
    linear-gradient(180deg, #59d7ff 0%, #b7f4ff 62%, #e9fbff 100%);
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

.game-shell {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

.cover-screen {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #55d2f7;
}

.cover-screen img {
  position: absolute;
  z-index: 0;
  width: min(100vw, calc(100vh * 0.5625));
  width: min(100vw, calc(100dvh * 0.5625));
  height: min(100vh, calc(100vw * 1.7777778));
  height: min(100dvh, calc(100vw * 1.7777778));
  object-fit: contain;
  background: #087df1;
}

.start-game-button {
  position: absolute;
  left: 50%;
  bottom: max(58px, calc(env(safe-area-inset-bottom) + 42px));
  z-index: 2;
  width: min(280px, calc(100vw - 56px));
  min-height: 68px;
  transform: translateX(-50%);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #ff6a4b 0%, #ff4f7b 48%, #ff9fd2 100%);
  box-shadow: 0 18px 34px rgba(255, 79, 123, 0.38), inset 0 2px 0 rgba(255, 255, 255, 0.55);
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-size: clamp(30px, 8vw, 46px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  transition: transform 160ms ease, filter 160ms ease;
}

.start-game-button:active {
  transform: translateX(-50%) translateY(2px) scale(0.98);
}

.phone-stage {
  position: relative;
  width: min(calc(100vw - 24px), 460px, calc((100vh - 24px) * 0.5625));
  width: min(calc(100vw - 24px), 460px, calc((100dvh - 24px) * 0.5625));
  aspect-ratio: 9 / 16;
  height: auto;
  overflow: hidden;
  border-radius: 28px;
  background: #87e9ff;
  box-shadow: var(--shadow);
  isolation: isolate;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
}

.top-hud,
.reward-panel,
.bottom-hud,
.side-actions {
  position: absolute;
  z-index: 3;
}

.top-hud {
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cup-dot {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 32%, #fff 0 12%, transparent 13%),
    linear-gradient(145deg, var(--gold), #ff8b3d);
  box-shadow: 0 6px 14px rgba(255, 146, 61, 0.35);
}

.brand-lockup p {
  margin: 0;
  color: #1570a6;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.brand-lockup h1 {
  max-width: 236px;
  margin: 0;
  color: #0879d9;
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(21px, 5.4vw, 29px);
  font-weight: 800;
  line-height: 0.95;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.86);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.language-control {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1300;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  height: 40px;
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  color: #13648e;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 10px 22px rgba(14, 118, 168, 0.22);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.language-control span {
  display: none;
}

.language-control select {
  width: 78px;
  height: 29px;
  border: 0;
  border-radius: 999px;
  color: #0b6393;
  background: #eafaff;
  font-size: 13px;
  font-weight: 900;
  outline: none;
}

.reward-panel {
  top: 76px;
  left: 14px;
  right: 14px;
  padding: 11px 14px 10px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 20px;
  background: var(--cloud);
  box-shadow: 0 12px 26px rgba(17, 102, 157, 0.18);
  backdrop-filter: blur(10px);
}

.reward-title,
.reward-chips {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.reward-title {
  color: #126497;
  font-weight: 900;
}

.reward-title strong {
  color: #0090ff;
  font-family: "Baloo 2", sans-serif;
  font-size: 22px;
  line-height: 1;
}

.reward-track {
  position: relative;
  height: 10px;
  margin: 10px 4px 6px;
  border-radius: 999px;
  background: #bcecff;
  overflow: hidden;
}

.track-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #13b7ff, #18e0c6, #ffe15f);
  transition: width 240ms ease;
}

.reward-track i {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  border: 3px solid #eaffff;
  border-radius: 50%;
  background: #00a3ff;
  transform: translate(-50%, -50%);
}

.reward-track i:nth-child(2) { left: 0%; }
.reward-track i:nth-child(3) { left: 25%; }
.reward-track i:nth-child(4) { left: 50%; }
.reward-track i:nth-child(5) { left: 75%; }
.reward-track i:nth-child(6) { left: 100%; }

.reward-chips span {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #ff5b86, #ff9c4a);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(255, 79, 123, 0.22);
}

.side-actions {
  left: 50%;
  right: auto;
  bottom: 96px;
  width: min(calc(100% - 64px), 320px);
  display: flex;
  justify-content: space-between;
  transform: translateX(-50%);
  pointer-events: none;
}

.pill-button {
  min-width: 76px;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 999px;
  color: white;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 10px 18px rgba(7, 122, 190, 0.26);
  pointer-events: auto;
  transition: transform 160ms ease, filter 160ms ease;
}

.pill-button:active,
.message-card button:active {
  transform: translateY(2px) scale(0.98);
}

.shoot-button:active {
  transform: translateX(-50%) translateY(2px) scale(0.98);
}

.pill-button.secondary {
  background: linear-gradient(135deg, #15b7ff, #00d5ff);
}

.pill-button.coin {
  background: linear-gradient(135deg, #ffc84d, #ff8c38);
}

.bottom-hud {
  left: 50%;
  right: auto;
  bottom: 18px;
  width: min(calc(100% - 64px), 280px);
  display: block;
  transform: translateX(-50%);
}

.shot-meta {
  position: absolute;
  bottom: 10px;
  width: 62px;
  min-width: 0;
  min-height: 48px;
  padding: 6px 5px 5px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  text-align: center;
  color: #146d9d;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
}

.shot-meta:first-child {
  right: calc(50% + 104px);
}

.shot-meta:last-child {
  left: calc(50% + 104px);
}

.shot-meta span,
.shoot-button small {
  display: block;
  font-size: 11px;
  font-weight: 900;
  opacity: 0.78;
}

.shot-meta strong {
  display: block;
  font-family: "Baloo 2", sans-serif;
  font-size: 25px;
  line-height: 1;
}

.shoot-button {
  position: absolute;
  left: 50%;
  bottom: 0;
  display: block;
  width: min(176px, 50vw);
  min-width: 0;
  min-height: 66px;
  margin: 0;
  transform: translateX(-50%);
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, #ff6a4b 0%, #ff4f7b 48%, #ff9fd2 100%);
  box-shadow: 0 14px 24px rgba(255, 79, 123, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.55);
  transition: transform 160ms ease, filter 160ms ease;
}

.shoot-button span {
  display: block;
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(23px, 6vw, 30px);
  font-weight: 800;
  line-height: 0.95;
}

.shoot-button:disabled {
  cursor: default;
  filter: grayscale(0.5) brightness(0.92);
}

.message-overlay,
.tips-panel,
.settlement-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(23, 116, 162, 0.18);
  backdrop-filter: blur(5px);
}

.hidden {
  display: none !important;
}

.message-card,
.tips-card,
.settlement-card {
  width: min(100%, 340px);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.settlement-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 40px);
  background: rgba(14, 88, 128, 0.5);
  backdrop-filter: blur(8px);
}

.settlement-card {
  width: min(94vw, 1180px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  padding: clamp(10px, 1.4vw, 18px);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.96);
}

.settlement-card video {
  display: block;
  width: 100%;
  height: min(72vh, 660px);
  height: min(72dvh, 660px);
  border-radius: 18px;
  background: #0b5f8e;
  object-fit: contain;
}

.settlement-card button {
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, #00a8ff, #18dec9);
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(0, 168, 255, 0.23);
}

@media (max-width: 520px) {
  .settlement-overlay {
    padding: max(12px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }

  .settlement-card {
    width: min(96vw, 430px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 8px;
    border-radius: 22px;
  }

  .settlement-card video {
    height: min(74vh, 640px);
    height: min(74dvh, 640px);
    border-radius: 16px;
  }

  .settlement-card button {
    min-height: 50px;
    margin-top: 8px;
  }
}

.message-card {
  padding: 26px 20px 20px;
  text-align: center;
}

.message-card strong {
  display: block;
  color: var(--coral);
  font-family: "Baloo 2", sans-serif;
  font-size: 42px;
  line-height: 0.95;
}

.message-card p {
  margin: 8px 0 18px;
  color: #186894;
  font-weight: 900;
}

.message-card button {
  min-width: 154px;
  min-height: 48px;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, #00a8ff, #18dec9);
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(0, 168, 255, 0.23);
}

.tips-card {
  position: relative;
  padding: 22px 20px 20px;
}

.tips-card h2 {
  max-width: 250px;
  margin: 0 0 12px;
  color: #0879d9;
  font-family: "Baloo 2", sans-serif;
  font-size: 25px;
  line-height: 1.02;
}

.tips-card ul {
  margin: 0;
  padding: 0 0 0 19px;
}

.tips-card li {
  margin: 10px 0;
  color: #255b76;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.32;
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #0c7fc2;
  background: #e7faff;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

@media (min-width: 860px) {
  body {
    overflow: hidden;
  }

  .game-shell {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px;
  }

  .phone-stage {
    width: min(76vw, 520px, calc(92vh * 0.5625));
    width: min(76vw, 520px, calc(92dvh * 0.5625));
    aspect-ratio: 9 / 16;
    height: auto;
  }

  .start-game-button {
    bottom: 72px;
    width: 310px;
  }

  .cover-screen img {
    width: min(100vw, calc(100vh * 0.5625));
    width: min(100vw, calc(100dvh * 0.5625));
    height: min(100vh, calc(100vw * 1.7777778));
    height: min(100dvh, calc(100vw * 1.7777778));
  }

  .language-control {
    top: 68px;
    left: calc(50% + 260px);
    right: auto;
  }
}

@media (max-width: 520px) {
  .phone-stage {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
  }

  .game-shell {
    padding: 0;
  }

  .brand-lockup {
    gap: 6px;
    min-width: 0;
    padding-right: 82px;
  }

  .brand-lockup h1 {
    width: calc(100vw - 206px);
    max-width: calc(100vw - 206px);
    font-size: clamp(22px, 5.6vw, 25px);
  }

  .brand-lockup p {
    display: none;
  }

  .language-control {
    top: 12px;
    right: 12px;
    left: auto;
    height: 38px;
    padding: 4px 6px;
  }

  .language-control select {
    width: 76px;
    height: 29px;
  }

  .reward-panel {
    top: 68px;
    left: 14px;
    right: 14px;
    max-width: calc(100vw - 28px);
    padding: 10px 10px 9px;
  }

  .reward-title {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .reward-title span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .reward-title strong {
    font-size: 18px;
    white-space: nowrap;
    justify-self: start;
  }

  .reward-chips {
    gap: 8px;
  }

  .reward-chips span {
    padding-inline: 6px;
    font-size: 10px;
  }

  .bottom-hud {
    left: 50%;
    right: auto;
    width: min(calc(100% - 64px), 280px);
  }

  .bottom-hud .shot-meta:last-child {
    display: block;
  }

  .shot-meta {
    width: 58px;
    min-height: 48px;
    padding-inline: 4px;
  }

  .shot-meta:first-child {
    right: calc(50% + 86px);
  }

  .shot-meta:last-child {
    left: calc(50% + 86px);
  }

  .shot-meta span,
  .shoot-button small {
    font-size: 10px;
  }

  .shot-meta strong {
    font-size: 21px;
  }

  .shoot-button {
    width: min(174px, 48vw);
  }
}
